--骑士秘宝
local qishimibao = fk.CreateSkill {
    name = "mcdh_qishimibao",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

qishimibao:addEffect(fk.Damaged,{
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(self) and target == player
    end,
    on_use =  function(self, event, target, player, data)
        local room = player.room
        player:drawCards(3, self.name)
        local choices = {"qishimibao1","qishimibao2"}
        if player:isKongcheng()  then
            table.removeOne(choices,"qishimibao1")
        end
        if player:isNude()  or  not data.from then
            table.removeOne(choices,"qishimibao2")
        end
        if #choices > 0 then
            local choice = room:askForChoice(player, choices, self.name, nil, nil, {"qishimibao1","qishimibao2"})
            if choice == "qishimibao1" then
                local handcards = player:getCardIds("h")
                player:showCards(handcards)
            elseif choice == "qishimibao2" then
                local id = room:askForCardChosen(player,player, "he", self.name)
                room:moveCards({
                    ids = {id},
                    from = player.id,
                    to = data.from.id,
                    toArea = Card.PlayerHand ,
                    moveReason = fk.ReasonGive,
                    skillName = self.name,
                })
            end
        end
    end
})

Fk:loadTranslationTable{
    ["mcdh_qishimibao"] = "骑士秘宝",
    [":mcdh_qishimibao"] = "当你受到伤害后，你可以摸三张牌，然后展示所有手牌或交给伤害来源一张牌。" ,
    ["qishimibao1"] = "展示所有手牌",
    ["qishimibao2"] = "交给伤害来源一张牌"
}

return qishimibao